$( document ).on( "pagecreate", "#sendMyflowerMore", function( event ) {
	access_token=getQueryString("access_token");
	pageNo="1";
	pageSize="10";
	$("#wrapper_sendMyflowerMore  #pullDown").hide();
	
	var scrollObj_sendMyflowerMore=scrollPlugLoadedOfReturn("wrapper_sendMyflowerMore",
			function() {
				setTimeout(function () {
					if(pageNo >= totalPage)
						return;
					pageNo++;
					loadData_More_Detail(false,scrollObj_sendMyflowerMore);
				}, 1000);	
			},
			function() {
//				setTimeout(function () {
//					pageNo=1;
//					loadData_redFlowerRank(true);
//				}, 1000);
				scrollObj_sendMyflowerMore.refresh();
			});
	
	loadData_More_Detail(true,scrollObj_sendMyflowerMore);
});

/**
 * 
 * @param isFresh 是否刷新
 * @param isFresh 是否是分页加载数据
 */
function loadData_More_Detail(isFresh,scrollObj_sendMyflowerMore){
	$.ajax({
	  	url: rootPath+"/redFlower/sendMeFloweList.do",
	  	type: "POST",
	  	dataType: "text",
		data: "access_token="+access_token+"&pageNo="+pageNo+"&pageSize="+pageSize,
	  	success: function( response ) {
	  		var data=$.parseJSON(response);
			if(data.state=="200"){
				totalPage=data.data.totalPage;
		  		var totalRow=data.data.totalRow;
		  		var arr=data.data.rows;
				var content = "";
				for (var i=0;i<arr.length;i++){
					var headerPic=rootPath+defaultHeadPic;
					//当头像不为空时，校验评论类型是否为0（实名）
					if(arr[i].sendManHeadImgUrl!=undefined && arr[i].sendManHeadImgUrl!=""){
						headerPic=arr[i].sendManHeadImgUrl;
					}	
					var picPath = "/images/weixin/flower/flower_bloom.gif";//完整的花
					var notice = "送给我一朵";
					if('admin'==arr[i].sendManName){
						picPath = "/images/weixin/flower/flower_01.png";//完整的花
						notice = "奖励我一个花瓣";
					}
					var name = arr[i].sendManName=='admin'?"系统":arr[i].sendManName;
					content +='<li data-icon="false">\
							  <a href="#"  '+comStyle+'>\
								<img  '+imgStyle+' src="'+headerPic+'" class="ui-li-icon">\
								<p '+margin_top_no+'><span style="font-size:15px;">\
									<span class="text_strong">'+name+'</span></span>\
								</p>\
								<p '+margin_top_6+' onclick="p_show(this)" >'+arr[i].createTime+"&nbsp;"+ notice +'<img src='+rootPath+picPath+' style="width:20px;height:20px;"/></p>\
							  </a>\
						</li>';
				}
				if(arr.length<pageSize){
					$("#wrapper_sendMyflowerMore  #pullUp").hide();
				}else{
					$("#wrapper_sendMyflowerMore  #pullUp").show();
				}
				if(isFresh && $("#thelist_sendMyflowerMore").html()!=""){
					$("#thelist_sendMyflowerMore").html("");
				}
				$("#thelist_sendMyflowerMore").append(content).listview('refresh');
				
				scrollObj_sendMyflowerMore.refresh();
				
			}else{
				alert_wx('fail',data.msg);
			}
	  	}
	});
}

